package cn.hs.service.impl;/**
 * @author Jovan Hou 2024/10/28
 **/

import cn.hs.entity.Mynotice;
import cn.hs.entity.Mytest;
import cn.hs.mapper.MytestMapper;
import cn.hs.service.MyTestService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName MyTestServiceImpl
 * @Description TODO
 * @Author CnYuu
 * @Date 2024年10月28日 17:36
 * @Version 1.0
 */
@Service
public class MyTestServiceImpl implements MyTestService
{
    @Autowired
    private MytestMapper mytestMapper;


    @Override
    public int insert(Mytest mytest)
    {
        return mytestMapper.insertSelective(mytest);
    }

    @Override
    public int update(Mytest mytest)
    {
        return mytestMapper.updateByPrimaryKey(mytest);
    }

    @Override
    public int delete(Integer id)
    {
        return mytestMapper.deleteByPrimaryKey(Long.valueOf(id));
    }

    @Override
    public PageInfo findByUserId(Integer pageNum, Integer pageSize, Integer id)
    {
        PageHelper.startPage(pageNum, pageSize);
        List<Integer> mytests = mytestMapper.selectUserId(id);
        PageInfo<Integer> pageInfo = new PageInfo<>(mytests);
        return pageInfo;
    }

    @Override
    public int deleteByAllId(Mytest mytest)
    {

        return mytestMapper.delete(mytest);
    }


}
